#include<iostream>
#include<climits>
#include<deque>
using namespace std;
const int N=1e5+10;
int nums[N];
int shortestSubarray(int n,int k)
{
	deque<int> st;
	int ret=INT_MAX;
	for(int i=1;i<=n;i++)
	{

		while(!st.empty()&&nums[st.back()]>=nums[i])
		{
			st.pop_back();
		}

		while(!st.empty()&&nums[i]-nums[st.front()]>=k)
		{
			ret=min(ret,i-st.front());
			st.pop_front();
		}

		st.push_back(i);

	}
	return ret==INT_MAX?-1:ret;
}
int main()
{
	int n,k;cin>>n>>k;
	for(int i=1;i<=n;i++)
	{
		int x;cin>>x;
		nums[i]=nums[i-1]+x;
	}

	cout<<shortestSubarray(n,k)<<endl;
}